package cn.wolfcode.luowowo.article.service.impl;

import cn.wolfcode.luowowo.article.domain.StrategyCommend;
import cn.wolfcode.luowowo.article.mapper.StrategyCommendMapper;
import cn.wolfcode.luowowo.article.query.StrategyCommendQuery;
import cn.wolfcode.luowowo.article.service.IStrategyCommendService;
import com.alibaba.dubbo.config.annotation.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Service
public class strategyCommendServiceImpl implements IStrategyCommendService {
    @Autowired
    private StrategyCommendMapper strategyCommendMapper;


    @Override
    public PageInfo query(StrategyCommendQuery qo) {
        PageHelper.startPage(qo.getCurrentPage(),qo.getPageSize(),qo.getOrderBy());
        List<StrategyCommend> list = strategyCommendMapper.selectAll();
        return new PageInfo(list);
    }

    @Override
    public void saveOrUpdate(StrategyCommend strategyCommend) {

    }

    @Override
    public List<StrategyCommend> queryCommendTop5() {
        PageHelper.startPage(0,5,"sequence asc");
        List<StrategyCommend> top5 = strategyCommendMapper.selectAll();
        return top5;
    }
}
